<template>
    <el-table-column align="center" :prop="header.jsonKey" :label="header.jsonValue">
      <template v-for="subHeader in header.children" v-if="header.children&&header.children.length>0">
        <recursive-column :header="subHeader" :key="subHeader.jsonKey"></recursive-column>
      </template>
      <template slot-scope="scope">
        <span style="cursor: pointer;" v-if="header.type=='upload'" @click="previewFile(scope.row[header.jsonKey])">{{ scope.row[header.jsonKey] }}</span>
        <!-- |returnIDList(header.jsonKey) -->
        <span v-else>{{ scope.row[header.jsonKey] }}  
          <!-- <i v-if="header.jsonKey=='fkbl'">%</i>    -->
        </span>
      </template>
    </el-table-column>
  </template>
  
  <script>
  import request from '@/utils/request';
  export default {
    name: 'recursive-column',
    props: {
      header: Object
    },
    created(){
       
    },
    filters:{
      returnIDList(v,k){
        let list = sessionStorage.getItem('selectOptions')?JSON.parse(sessionStorage.getItem('selectOptions')):{}
        let arrList = list[k]
        let rtv = ""
        if(Array.isArray(arrList)){
          arrList.forEach((item,index)=>{
            if(v==item.id){
              rtv = item.jsonTitle
            }
          })
        }else{
          return v
        }
        return rtv
      }
    },
    methods:{
      previewFile(v){
        request({
          url: '/ht-bpmn/activiti/downloadFileSign?url='+v,
          method: 'post',
          data:{}
        }).then((res) => {
          if(res.code==200){
              window.open(res.data)
          }
        })
      }
    }
  }
  </script>
  